<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/view/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">	
	<title>Insert title here</title>
 	<link href="${project}/ds/css/styles.css" rel="stylesheet" />
    <link href="${project}/ds/css/input.css" rel="stylesheet"/>
    <link href="${project}/ds/css/roomStyle.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/layui/css/layui.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
    <link href="${project}/ds/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/ligerUI/skins/Gray2014/css/all.css" rel="stylesheet"/>

    <script src="${project}/ds/lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
    <script src="${project}/ds/js/XHD.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/layui/layui.js" type="text/javascript"></script>
    <script src="${project}/ds/js/layeralert.js" type="text/javascript"></script>
    <script src="${project}/ds/js/room/command.js" type="text/javascript"></script>
    <script src="${project}/ds/js/js/ws.js" type="text/javascript"></script>
    <script type="text/javascript">
        var manager;
        var loadindex;
        var layer;
        var usertype = -1;
        var user = getCookie("xhdcrm_uid");

        layui.use(['layer'],
            function () {
                layer = layui.layer;
               // websocketConnect();
            });

        $(function() {
            $("#form1").ligerForm();
            manager = $("#maingrid4")
                .ligerGrid({
                    columns: [
                        {
                            display: '序号',
                            width: 40,
                            render: function (rowData, rowindex) {
                                return rowindex + 1;
                            }
                        },
                        { display: "编号", name: "Code", width: 100 },
                        { display: "类型", name: "Type", width: 100, editor: { type: 'text' } },
                        { display: "提示备注(我们自己看的)", name: "Remark", width: 600 },
                        { display: "提示内容(显示给别人看的)", name: "Content", width: 600, editor: { type: 'text' } }
                        
                    ],
                    dataAction: "server",
                    sortName: "Code",
                    sortOrder: "asc",
                    enabledEdit: true,
                    pageSize: 30,
                    rowHeight: 22,
                    pageSizeOptions: [20, 30, 50, 100],
                    url: "/tishi/getGrid",
                    width: '100%',
                    height: '100%',
                    heightDiff: -1
                });
        });


        function closeconfigload() {
            layer.close(loadindex);
        }

        function CheckUrd() {
            var rows = manager.getData();
            console.log(rows);
            var postdata = JSON.stringify(rows);
            $.ajax({
                url: "/tishi/saveGrid",
                type: "post",
                dataType: "json",
                data: { json: postdata },
                success: function (result) {
                    if (result.result === "true") {
                        loadindex = layload("提示表保存中");
                       // var json = window.wsorder.loadtips(user);
                        //websocket.send(JSON.stringify(json));
                        window.layermsg(result.msg);
                    } else if (result.result === "false") {
                        window.layermsg(result.msg);
                    }
                }
            });

            /*var option = {
                elem: "#savetips",
                title: "保存提示",
                url: "../data/Tuser.ashx?Action=SaveTips",
                method: "post",
                type: "file",
                success: function (result) {
                    if (result === "false") {
                        layer.msg("上传格式不正确", { icon: 2 });
                    } else {
                        var path = result.path;
                        var url = "../data/Room.ashx?Action=openExcelData&src=" + path;
                        OpenUpload(url);
                    }
                }
            };*/
        }

    </script>
</head>
<body>
    <div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <div id="savebtn" onclick="CheckUrd()" class="layui-btn layui-btn-normal" style="margin-left:5px;margin-top:5px">保存</div>
            </div>
        </div>
    </div>
    <div style="height: 100%; width: 100%;">
        <div id="maingrid4" style="margin: -1px;margin-top:-15px"></div>
    </div>
</body>
</html>